// 解析.vue组件页面的代码

// 1.0 导入vue这个包
import Vue from 'vue';

// 2.0 导入 App.vue文件
import App from './App.vue';

//vue-router相关的代码
//  导入vue-router这个包
import VueRouter from 'vue-router';  //相当于 <script src="vue-router.js">

//  在Vue对象中通过use()方法来使用vue-router对象
Vue.use(VueRouter);
//图片预览轮播插件；
import VuePreview from 'vue-preview'
Vue.use(VuePreview)

// 3.0.3 定义路由对象并且初始化路由规则
// 3.0.3.1 导入需要注册的组件
import home from './components/home.vue';
import news from './components/news/newslist.vue';
import newsshow from './components/news/newsshow.vue';
import pictureshow from './components/picture/pictureshow.vue';
import imgshow from './components/picture/imgshow.vue';
import goodslist from './components/goods/goodslist.vue';
import goodsinfo from './components/goods/goodsinfo.vue';
import goodsshow from './components/goods/goodsshow.vue';
import shopcart from './components/goods/shopcartlist.vue';
var vueRouterObj = new VueRouter({
	linkActiveClass:"mui-active",
	routes:[
		{path:'/',redirect:'/home'},
		{path:'/home',component:home},
        {path:'/news/newslist',component:news},
        {path:'/news/newsshow/:newsid',component:newsshow},
        {path:'/picture/pictureshow',component:pictureshow},
        {path:'/photo/imageshow/:imgid',component:imgshow},
        {path:'/photo/goodslist',component:goodslist},
        {path:'/photo/goodsinfo/:goodsid',component:goodsinfo},
        {name:'goodsshow',path:'/photo/goodsshow/:goodsid',component:goodsshow},
		{path:'/goods/shopcart',component:shopcart}
	]
});



// 4.0 mint-ui的使用
// 4.0.1 导入mint-ui的样式
import 'mint-ui/lib/style.min.css'
// 4.0.2 导入mint-ui的组件包
import mintUI  from 'mint-ui'
// 4.0.3 将mintUI对象在Vue中通过use()进行绑定
import { Swipe, SwipeItem } from 'mint-ui';

Vue.component(Swipe.name, Swipe);
Vue.component(SwipeItem.name, SwipeItem);
Vue.use(mintUI);
import { Lazyload } from 'mint-ui';

Vue.use(Lazyload);
//导入全局静态css样式；
import '../statics/css/site.css';

// 5.0 导入mui的css
import '../statics/mui/css/mui.css'
import '../statics/mui/css/icons-extra.css'
// 使用vue-resource
//  导入vue-resource
import vueResource  from 'vue-resource';
// 6.0.2 使用
Vue.use(vueResource);
//设置全局过滤器
import moment from 'moment';
Vue.filter('moments', function (input,str) {
	str=str?str:'YYYY-MM-DD';
    return moment(input).format(str);
})


// 最后： 将App中的内容编译解析出来替换index.html中的<div id="app"></div>
new Vue({
	el:'#app',
	router:vueRouterObj,  //使用路由规则对象
	// render:function(create){create(App);}  es5语法
	render:create=>create(App) //es6语法
});